package com.neuedu.mvc.controller;

import org.springframework.stereotype.Controller;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 项目：      spring-framework
 * 类名:       MyServletController
 * 创建时间：  2024/3/15 11：59
 * 描述 :
 * 作者 :     张金山
 * QQ :     314649444
 * Site:      https://jshand.gitee.io
 */
@Controller
//@Controller("myServletController")
public  class MyServletController implements Servlet {


    /**
     * http://localhost:8080/web/myServletController
     * @param req 	the <code>ServletRequest</code> object that contains
     *			the client's request
     *
     * @param res 	the <code>ServletResponse</code> object that contains
     *			the servlet's response
     *
     * @throws ServletException
     * @throws IOException
     */
    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
         HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
        System.out.println("后台 SimpleurlController 执行");

        PrintWriter out = response.getWriter();
        out.write("MyServletController");
        out.flush();
        out.close();
    }













    @Override
    public void init(ServletConfig config) throws ServletException {  }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }
    @Override
    public String getServletInfo() {  return null; }

    @Override
    public void destroy() { }
}
